#!/bin/bash
echo "Running pipt server."
cat /dev/null > procesi.pid
java -cp ./bin fri.pipt.server.Main games/maze.game &
server=$!
sleep 1
for i in $(seq 1 $1); do
	echo "Running convict #"$i
	java -cp ./bin fri.pipt.agent.Agent localhost fri.pipt.agent.indy.Indy  &
	echo $! >> procesi.pid
done
for i in $(cat procesi.pid); do
	echo "Killing process pid=" $i
	kill $i
done
